package com.ai.networking.netty.decoder;

import com.ai.common.constant.AlgorithmConstant;
import com.ai.entity.network.*;
import com.alibaba.fastjson.JSONObject;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;
import java.net.InetSocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;


/**
 * 解码
 * @Author jiaok
 * @Date 2023-06-20 11:44
 */
@Slf4j
public class L1ToSysMessageDecoder extends ByteToMessageDecoder {


    /**
     * 会发送信号的ip
     */
    private static final ArrayList<String>  signalIpList= new ArrayList<>(Arrays.asList());
    /**
     * 解析信道数据
     * @param channelHandlerContext
     * @param byteBuf
     * @param out 解析之后的数据
     * @throws Exception
     */
    @Override
    protected void decode(ChannelHandlerContext channelHandlerContext,
                          ByteBuf byteBuf,
                          List<Object> out) throws Exception {

        InetSocketAddress ipSocket = (InetSocketAddress) channelHandlerContext.channel().remoteAddress();
        String clientIp = ipSocket.getAddress().getHostAddress();
        Integer port = ipSocket.getPort();
//        if (signalIpList.contains(clientIp)){
        int num = byteBuf.readableBytes();
        log.info("===========================  {}  ===========================   ",num);
//        if (256 != num){
//            log.info("=========================== 长度不足256  ===========================");
//            return;
//        }
        while (num >= 256){
            byte[] signalBytes = new byte[256];
            byteBuf.readBytes(signalBytes);
            String plcSignal = Arrays.toString(signalBytes);

            log.info("===========================   接收到{} , {} 发送的信号 {} ===========================   ",clientIp,plcSignal);
            byte[] lengthBytes = new byte[4];
            System.arraycopy(signalBytes, 0, lengthBytes, 0, 4);
            // 将字节数组转换为字符串
            String length = new String(lengthBytes, StandardCharsets.US_ASCII).replace("\0", "").trim();
            // 获取电文号（6 字节）
            byte[] teleNoBytes = new byte[6];
            System.arraycopy(signalBytes, 4, teleNoBytes, 0, 6);
            // 将字节数组转换为字符串
            String teleNo = new String(teleNoBytes, StandardCharsets.US_ASCII).replace("\0", "").trim();

            log.info("===========================  操作信号：{}  ===========================",teleNo);

            //判断是否为心跳电文
            if (teleNo.equals(AlgorithmConstant.SI_TO_DS_HEARTBEAT)
                    || teleNo.equals(AlgorithmConstant.PLC_TO_DS_HEARTBEAT)){
                log.info("    -------------------  开始解析心跳信号 开始解析  -------------------    ");

                HeartMessage heartMessage = getHeartMessage(clientIp, port, signalBytes, length, teleNo);
                //将解析过之后的数据放置于管道中
                out.add(heartMessage);
                return;
            }
            if (teleNo.equals(AlgorithmConstant.L2_TO_DS_STEEL_DETAILS)){
                log.info("    -------------------  开始解析L2发送的操作信号 开始解析  -------------------    ");
                L2ToDsSysMessage l2ToDsSysMessage = getL2ToDsSysMessage(clientIp, port,signalBytes, length, teleNo);
                //将解析过之后的数据放置于管道中
                out.add(l2ToDsSysMessage);
                return;
            }
            if (teleNo.equals(AlgorithmConstant.L1_TO_DS_QUALITY_CHECK_STATUS)){
                log.info("    -------------------  开始解析L1发送的操作信号 开始解析  -------------------    ");
                L1ToDsSysMessage l1ToDsSysMessage = getL1ToDsSysMessage(clientIp, port,signalBytes, length, teleNo);
                out.add(l1ToDsSysMessage);
                return;
            }
            if (teleNo.equals(AlgorithmConstant.SI_TO_DS_DEFECT_DETECTION_STATUS) ||
                    teleNo.equals(AlgorithmConstant.SI_TO_DS_DEFECT_DETAILS) ||
                    teleNo.equals(AlgorithmConstant.SI_TO_DS_DEFECT_OFFSET)){
                log.info("    -------------------  开始解析SI发送的操作信号 开始解析  -------------------    ");
                SiToDsSysMessage siToDsSysMessage = getSiToDsSysMessage(clientIp, port,signalBytes, length, teleNo);
                out.add(siToDsSysMessage);
                return;
            }
            if (teleNo.equals(AlgorithmConstant.AG_TO_DS_GRINDING_PERFORMANCE)){
                log.info("    -------------------  开始解析AG发送的操作信号 开始解析  -------------------    ");
                AgToDsSysMessage agToDsSysMessage = getAgToDsSysMessage(clientIp, port,signalBytes, length, teleNo);
                out.add(agToDsSysMessage);
                return;
            }
        }
//        }
    }

    private AgToDsSysMessage getAgToDsSysMessage(String clientIp, Integer port, byte[] signalBytes, String length, String teleNo) {
        // 3. 提取 MAT_NO (钢卷号)，长度 20 字节
        byte[] matNoBytes = new byte[20];
        System.arraycopy(signalBytes, 10, matNoBytes, 0, 20);
        String matNo = new String(matNoBytes).replace("\0", "").replace("\0", "").trim();

        // 4. 提取 START_TIME_1 (1#机器人打磨起始时间)，长度 14 字节
        byte[] startTime1Bytes = new byte[14];
        System.arraycopy(signalBytes, 30, startTime1Bytes, 0, 14);
        String startTime1 = new String(startTime1Bytes).replace("\0", "").replace("\0", "").trim();

        // 5. 提取 END_TIME_1 (1#机器人打磨结束时间)，长度 14 字节
        byte[] endTime1Bytes = new byte[14];
        System.arraycopy(signalBytes, 44, endTime1Bytes, 0, 14);
        String endTime1 = new String(endTime1Bytes).replace("\0", "").trim();

        // 6. 提取 TRACK_MODEL_1 (1#机器人打磨轨迹模式)，长度 2 字节
        byte[] trackModel1Bytes = new byte[2];
        System.arraycopy(signalBytes, 58, trackModel1Bytes, 0, 2);
        String trackModel1 = new String(trackModel1Bytes).replace("\0", "").trim();
        if ("".equals(trackModel1)){
            trackModel1 = "0";
        }
        // 7. 提取 DOWN_FORCE_1 (1#机器人下压力)，N类型，6,3 格式
        byte[] downForce1Bytes = new byte[6];
        System.arraycopy(signalBytes, 60, downForce1Bytes, 0, 6);
        String downForce1Str = new String(downForce1Bytes);
        // 3. 分离整数部分和小数部分
        String integerPart = downForce1Str.substring(0, 3);
        String decimalPart = downForce1Str.substring(3, 6);
        String formattedStr1 = integerPart + "." + decimalPart;
        BigDecimal downForce1 = new BigDecimal(formattedStr1.trim());

        // 8. 提取 START_TIME_2 (2#机器人打磨起始时间)，长度 14 字节
        byte[] startTime2Bytes = new byte[14];
        System.arraycopy(signalBytes, 66, startTime2Bytes, 0, 14);
        String startTime2 = new String(startTime2Bytes).replace("\0", "").trim();

        // 9. 提取 END_TIME_2 (2#机器人打磨结束时间)，长度 14 字节
        byte[] endTime2Bytes = new byte[14];
        System.arraycopy(signalBytes, 80, endTime2Bytes, 0, 14);
        String endTime2 = new String(endTime2Bytes).replace("\0", "").trim();

        // 10. 提取 TRACK_MODEL_2 (2#机器人打磨轨迹模式)，长度 2 字节
        byte[] trackModel2Bytes = new byte[2];
        System.arraycopy(signalBytes, 94, trackModel2Bytes, 0, 2);
        String trackModel2 = new String(trackModel2Bytes).replace("\0", "").trim();
        if ("".equals(trackModel2)){
            trackModel2 = "0";
        }
        // 11. 提取 DOWN_FORCE_2 (2#机器人下压力)，N类型，6,3 格式
        byte[] downForce2Bytes = new byte[6];
        System.arraycopy(signalBytes, 96, downForce2Bytes, 0, 6);
        String downForce2Str = new String(downForce2Bytes);
        String integerPart2 = downForce2Str.substring(0, 3);
        String decimalPart2 = downForce2Str.substring(3, 6);
        String formattedStr2 = integerPart2 + "." + decimalPart2;
        BigDecimal downForce2 = new BigDecimal(formattedStr2.trim());

        // 12. 提取 SURFACE_FLAG (上下表面标记)，长度 1 字节
        byte[] surfaceFlagBytes = new byte[1];
        System.arraycopy(signalBytes, 102, surfaceFlagBytes, 0, 1);
        String surfaceFlag = new String(surfaceFlagBytes).replace("\0", "").trim();
        if ("".equals(surfaceFlag)){
            surfaceFlag = "0";
        }

        // 13. 备用字段，长度 146 字节
        byte[] spareBytes = new byte[153];
        System.arraycopy(signalBytes, 103, spareBytes, 0, 153);
        String spare = new String(spareBytes).replace("\0", "").trim();
        log.info("=========================== 解析来自 {}:{} 发送的信号 解析完毕 ===========================", clientIp, port);
        AgToDsSysMessage agToDsSysMessage = new AgToDsSysMessage();
        agToDsSysMessage.setLength(length);
        agToDsSysMessage.setTeleNo(teleNo);
        agToDsSysMessage.setMatNo(matNo);
        agToDsSysMessage.setStartTime1(startTime1);
        agToDsSysMessage.setEndTime1(endTime1);
        agToDsSysMessage.setTrackModel1(trackModel1);
        agToDsSysMessage.setDownForce1(downForce1);
        agToDsSysMessage.setStartTime2(startTime2);
        agToDsSysMessage.setEndTime2(endTime2);
        agToDsSysMessage.setTrackModel2(trackModel2);
        agToDsSysMessage.setDownForce2(downForce2);
        agToDsSysMessage.setSurfaceFlag(surfaceFlag);
        agToDsSysMessage.setSpare(spare);
        agToDsSysMessage.setClientIp(clientIp);
        agToDsSysMessage.setSourcePort(port);
        log.info("解析内容：{}",agToDsSysMessage);
        return agToDsSysMessage;
    }

    private static SiToDsSysMessage getSiToDsSysMessage(String clientIp, Integer port, byte[] signalBytes, String length, String teleNo) {
        String coilNo = "";
        String faultState = "";
        String defect = "";
        String straightDeviation = "";
        String spare = "";
        SiToDsSysMessage siToDsSysMessage = new SiToDsSysMessage();
        siToDsSysMessage.setClientIp(clientIp);
        siToDsSysMessage.setSourcePort(port);
        siToDsSysMessage.setLength(length);
        siToDsSysMessage.setTeleNo(teleNo);
        if (teleNo.equals(AlgorithmConstant.SI_TO_DS_DEFECT_DETECTION_STATUS)){
            byte[] faultStateBytes = new byte[100];
            System.arraycopy(signalBytes, 10, faultStateBytes, 0, 100);
            faultState = new String(faultStateBytes).replace("\0", "").trim();
            // 8. 备用字段，长度 146 字节
            byte[] spareBytes = new byte[146];
            System.arraycopy(signalBytes, 110, spareBytes, 0, 146);
            spare = new String(spareBytes).replace("\0", "").trim();
            siToDsSysMessage.setFaultState(faultState);
            siToDsSysMessage.setSpare(spare);
        }else if (teleNo.equals(AlgorithmConstant.SI_TO_DS_DEFECT_DETAILS)) {
            byte[] coilNoBytes = new byte[16];
            System.arraycopy(signalBytes, 10, coilNoBytes, 0, 16);
            coilNo = new String(coilNoBytes).replace("\0", "").trim();

            byte[] defectBytes = new byte[2];
            System.arraycopy(signalBytes, 26, defectBytes, 0, 2);
            defect = new String(defectBytes).replace("\0", "").trim();
            // 8. 备用字段，长度 146 字节
            byte[] spareBytes = new byte[228];
            System.arraycopy(signalBytes, 28, spareBytes, 0, 228);
            spare = new String(spareBytes).replace("\0", "").trim();

            siToDsSysMessage.setCoilNo(coilNo);
            siToDsSysMessage.setDefect(defect);
            siToDsSysMessage.setSpare(spare);
        }else if (teleNo.equals(AlgorithmConstant.SI_TO_DS_DEFECT_OFFSET)){
            byte[] coilNoBytes = new byte[16];
            System.arraycopy(signalBytes, 10, coilNoBytes, 0, 16);
            coilNo = new String(coilNoBytes).replace("\0", "").trim();
            byte[] straightDeviationBytes = new byte[10];
            System.arraycopy(signalBytes, 26, straightDeviationBytes, 0, 10);
            straightDeviation = new String(straightDeviationBytes).replace("\0", "").trim();
            // 8. 备用字段，长度 146 字节
            byte[] spareBytes = new byte[220];
            System.arraycopy(signalBytes, 36, spareBytes, 0, 220);
            spare = new String(spareBytes).replace("\0", "").trim();
            siToDsSysMessage.setCoilNo(coilNo);
            siToDsSysMessage.setStraightDeviation(straightDeviation);
            siToDsSysMessage.setSpare(spare);
        }
        log.info("=========================== 解析来自 {}:{} 发送的信号 解析完毕 ===========================", clientIp, port);
        log.info("解析内容：{}",siToDsSysMessage);
        return siToDsSysMessage;
    }

    private static L1ToDsSysMessage getL1ToDsSysMessage(String clientIp, Integer port, byte[] signalBytes, String length, String teleNo) {
        // 3. 提取 AllowHomeworkTop (上表面准许作业)，长度 1 字节
        byte[] allowHomeworkTopBytes = new byte[1];
        System.arraycopy(signalBytes, 10, allowHomeworkTopBytes, 0, 1);
        String allowHomeworkTop = new String(allowHomeworkTopBytes).replace("\0", "").trim();

        // 4. 提取 AllowHomeworkDown (下表面准许作业)，长度 1 字节
        byte[] allowHomeworkDownBytes = new byte[1];
        System.arraycopy(signalBytes, 11, allowHomeworkDownBytes, 0, 1);
        String allowHomeworkDown = new String(allowHomeworkDownBytes).replace("\0", "").trim();

        // 5. 提取 OperationMode (作业模式)，长度 1 字节，自动或手动
        byte[] operationModeBytes = new byte[1];
        System.arraycopy(signalBytes, 12, operationModeBytes, 0, 1);
        String operationMode = new String(operationModeBytes).replace("\0", "").trim();

        // 6. 提取 TensionTop (上表面建张张力)，N类型，6,3 格式
        byte[] tensionTopBytes = new byte[6];
        System.arraycopy(signalBytes, 13, tensionTopBytes, 0, 6);
        String tensionTopStr = new String(tensionTopBytes).replace("\0", "").trim();
        String integerPartTop  = tensionTopStr.substring(0, 3);
        String decimalPartTop = tensionTopStr.substring(3,6);
        String formattedTopStr = integerPartTop + "." + decimalPartTop;
        BigDecimal tensionTop = new BigDecimal(formattedTopStr.trim());

        // 7. 提取 TensionDown (下表面建张张力)，N类型，6,3 格式
        byte[] tensionDownBytes = new byte[6];
        System.arraycopy(signalBytes, 19, tensionDownBytes, 0, 6);
        String tensionDownStr = new String(tensionDownBytes).replace("\0", "").trim();
        String integerPartDown  = tensionDownStr.substring(0, 3);
        String decimalPartDown = tensionDownStr.substring(3,6);
        String formattedDownStr = integerPartDown + "." + decimalPartDown;
        BigDecimal tensionDown = new BigDecimal(formattedDownStr.trim());

        // 8. 备用字段，长度 146 字节
        byte[] spareBytes = new byte[231];
        System.arraycopy(signalBytes, 25, spareBytes, 0, 231);
        String spare = new String(spareBytes).replace("\0", "").trim();
        log.info("=========================== 解析来自 {}:{} 发送的信号 解析完毕 ===========================", clientIp, port);
        L1ToDsSysMessage l1ToDsSysMessage = new L1ToDsSysMessage();
        l1ToDsSysMessage.setLength(length);
        l1ToDsSysMessage.setTeleNo(teleNo);
        l1ToDsSysMessage.setAllowHomeworkTop(allowHomeworkTop);
        l1ToDsSysMessage.setAllowHomeworkDown(allowHomeworkDown);
        l1ToDsSysMessage.setOperationMode(operationMode);
        l1ToDsSysMessage.setTensionTop(tensionTop);
        l1ToDsSysMessage.setTensionDown(tensionDown);
        l1ToDsSysMessage.setSpare(spare);
        l1ToDsSysMessage.setClientIp(clientIp);
        l1ToDsSysMessage.setSourcePort(port);
        log.info("解析内容：{}",l1ToDsSysMessage);
        return l1ToDsSysMessage;
    }


    /**
     * 解析心跳报文
     * @param clientIp 客户端ip
     * @param port 端口
     * @param signalBytes 信号字节数组
     * @param telLen 信号长度
     * @param telId 信号id标识
     * @return
     */
    private static HeartMessage getHeartMessage(String clientIp, Integer port, byte[] signalBytes, String telLen, String telId) {
        // 提取心跳部分的数据
        byte[] heartBeatSpareBytes = new byte[246];
        System.arraycopy(signalBytes, 10, heartBeatSpareBytes, 0, 246);
        String heartBeatSpare = new String(heartBeatSpareBytes).replace("\0", "").trim();

        // 输出心跳解析完毕的日志
        log.info("=========================== 解析来自 {}:{} 发送的心跳信号 解析完毕 ===========================", clientIp, port);

        // 创建 heartMessage 对象
        HeartMessage heartMessage = new HeartMessage();

        // 填充 heartMessage 对象
        heartMessage.setTeleNo(telId);            // 设置电文号
        heartMessage.setLength(telLen);          // 设置电文长度
        heartMessage.setSpare(heartBeatSpare);   // 设置心跳空闲字段

        // 设置客户端信息
        heartMessage.setClientIp(clientIp);      // 设置客户端 IP
        heartMessage.setSourcePort(port);        // 设置客户端端口

        // 输出最终的解析结果
        log.info("=========================== 接收到心跳报文：{} ===========================", JSONObject.toJSONString(heartMessage));

        return heartMessage;
    }
    
    /**
     * 解析心跳报文
     * @param clientIp 客户端ip
     * @param port 端口
     * @param signalBytes 信号字节数组
     * @param length 信号长度
     * @param teleNo 信号id标识
     * @return
     */
    private static L2ToDsSysMessage getL2ToDsSysMessage(String clientIp, Integer port, byte[] signalBytes, String length, String teleNo) {
        // 1. 提取 CoilNo (钢卷号)，长度 16 字节
        byte[] coilNoBytes = new byte[16];
        System.arraycopy(signalBytes, 10, coilNoBytes, 0, 16);
        String coilNo = new String(coilNoBytes).replace("\0", "").trim();

        // 2. 提取 Length (长度)，N类型，8,3 格式
        byte[] lengthBytes = new byte[8];
        System.arraycopy(signalBytes, 26, lengthBytes, 0, 8);
        String lengthStr = new String(lengthBytes).replace("\0", "").trim();
//        String integerPart  = lengthStr.substring(0, 5);
//        String decimalPart = lengthStr.substring(5,8);
//        String formattedStr = integerPart + "." + decimalPart;
        BigDecimal lengthMm = new BigDecimal(lengthStr.trim());

        // 3. 提取 Width (宽度)，N类型，6,3 格式
        byte[] widthBytes = new byte[6];
        System.arraycopy(signalBytes, 34, widthBytes, 0, 6);
        String widthStr = new String(widthBytes).replace("\0", "").trim();
//        String integerWidthPart  = widthStr.substring(0, 3);
//        String decimalWidthPart = widthStr.substring(3,6);
//        String formattedWidthStr = integerWidthPart + "." + decimalWidthPart;
        BigDecimal width = new BigDecimal(widthStr.trim());

        // 4. 提取 Thickness (厚度)，N类型，6,3 格式
        byte[] thicknessBytes = new byte[6];
        System.arraycopy(signalBytes, 40, thicknessBytes, 0, 6);
        String thicknessStr = new String(thicknessBytes);
        String integerThicknessPart  = thicknessStr.substring(0, 3);
        String decimalThicknessPart = thicknessStr.substring(3,6);
        String formattedThicknessStr = integerThicknessPart + "." + decimalThicknessPart;
        BigDecimal thickness = new BigDecimal(formattedThicknessStr.trim());

        // 5. 提取 SteelGrade (出钢记号)，长度 8 字节
        byte[] steelGradeBytes = new byte[8];
        System.arraycopy(signalBytes, 46, steelGradeBytes, 0, 8);
        String steelGrade = new String(steelGradeBytes).replace("\0", "").trim();

        // 6. 提取 SortingGrade (分选度)，长度 2 字节
        byte[] sortingGradeBytes = new byte[2];
        System.arraycopy(signalBytes, 54, sortingGradeBytes, 0, 2);
        String sortingGrade = new String(sortingGradeBytes).replace("\0", "").trim();

        // 7. 提取 WorkOrderNo (生产合同号)，长度 10 字节
        byte[] workOrderNoBytes = new byte[10];
        System.arraycopy(signalBytes, 56, workOrderNoBytes, 0, 10);
        String workOrderNo = new String(workOrderNoBytes).replace("\0", "").trim();

        // 8. 提取 OrderQuality (钢种牌号)，长度 20 字节
        byte[] orderQualityBytes = new byte[20];
        System.arraycopy(signalBytes, 66, orderQualityBytes, 0, 20);
        String orderQuality = new String(orderQualityBytes).replace("\0", "").trim();

        // 9. 提取 FinalUse (最终用途)，长度 4 字节
        byte[] finalUseBytes = new byte[4];
        System.arraycopy(signalBytes, 86, finalUseBytes, 0, 4);
        String finalUse = new String(finalUseBytes).replace("\0", "").trim();

        // 10. 提取 FinalUser (最终用户代码)，长度 6 字节
        byte[] finalUserBytes = new byte[6];
        System.arraycopy(signalBytes, 90, finalUserBytes, 0, 6);
        String finalUser = new String(finalUserBytes).replace("\0", "").trim();

        // 11. 提取 Dummy (过渡卷标志)，长度 2 字节
        byte[] dummyBytes = new byte[2];
        System.arraycopy(signalBytes, 96, dummyBytes, 0, 2);
        String dummy = new String(dummyBytes).replace("\0", "").trim();

        // 12. 提取 SURF_STRUC_CODE (表面结构)，长度 4 字节
        byte[] surfStrucCodeBytes = new byte[4];
        System.arraycopy(signalBytes, 98, surfStrucCodeBytes, 0, 4);
        String surfStrucCode = new String(surfStrucCodeBytes).replace("\0", "").trim();

        // 13. 提取 POST_PROC (后处理方式)，长度 4 字节
        byte[] postProcBytes = new byte[4];
        System.arraycopy(signalBytes, 102, postProcBytes, 0, 4);
        String postProc = new String(postProcBytes).replace("\0", "").trim();
        // 14. 提取 spare (备用)，长度 150 字节
        byte[] spareBytes = new byte[150];
        System.arraycopy(signalBytes, 106, spareBytes, 0, 150);
        String spare = new String(spareBytes).replace("\0", "").trim();
        log.info("=========================== 解析来自 {}:{} 发送的信号 解析完毕 ===========================", clientIp, port);
        L2ToDsSysMessage l2ToDsSysMessage = new L2ToDsSysMessage();
        l2ToDsSysMessage.setLength(length);
        l2ToDsSysMessage.setTeleNo(teleNo);
        l2ToDsSysMessage.setCoilNo(coilNo);
        l2ToDsSysMessage.setLengthMm(lengthMm);
        l2ToDsSysMessage.setWidth(width);
        l2ToDsSysMessage.setThickness(thickness);
        l2ToDsSysMessage.setSteelGrade(steelGrade);
        l2ToDsSysMessage.setSortingGrade(sortingGrade);
        l2ToDsSysMessage.setWorkOrderNo(workOrderNo);
        l2ToDsSysMessage.setOrderQuality(orderQuality);
        l2ToDsSysMessage.setFinalUse(finalUse);
        l2ToDsSysMessage.setFinalUser(finalUser);
        l2ToDsSysMessage.setDummy(dummy);
        l2ToDsSysMessage.setSurfStrucCode(surfStrucCode);
        l2ToDsSysMessage.setPostProc(postProc);
        l2ToDsSysMessage.setSpare(spare);
        l2ToDsSysMessage.setClientIp(clientIp);
        l2ToDsSysMessage.setSourcePort(port);
        log.info("解析内容：{}",l2ToDsSysMessage);
        return l2ToDsSysMessage;
    }   
}
